//(function() {
//  describe('首页', function() {
//    return it('创建一个文件夹', function() {
//      browser.get('http://localhost:8000/');
//      expect(browser.getTitle()).toEqual('Cmis File Picker');
//      browser.sleep(5000);
//      element(By.css('.btn-create-fold')).click();
//      element.all(By.css('.nav-list .dropdown-menu a')).get(0).click();
//      element(By.model('folderName')).sendKeys('folderName' + Math.random());
//      return element.all(By.css('.table tr')).count().then(function(oldCount) {
//        element(By.css('.btn-right-aside')).click();
//        browser.sleep(2000);
//        return element.all(By.css('.table tr')).count().then(function(count) {
//          expect(count).toBe(oldCount + 1);
//          return console.log("new count " + count);
//        });
//      });
//    });
//  });

//}).call(this);

function Actions() {
    this.openBrowser = function(){
        browser.get('http://localhost:8000/');
    }
}

var PageObject = {
    createNew: function(){
        var pageObject = {};
        pageObject.addBtn = element(by.css('.btn-create-fold'));
        pageObject.createFolderBtn = element.all(By.css('.nav-list .dropdown-menu a')).get(0);
        pageObject.folderNameInput = element(By.model('folderName'));
        pageObject.crateFolderOkBtn = element.all(By.css('.btn-right-aside')).last();
        //pageObject.crateFolderOkBtn = element(By.xpath('.btn-right-aside button'));
        return pageObject;

    }
}




    describe('angularjs homepage', function() {

    it('create folder', function() {
        //open browser
        var actions = new Actions();
        actions.openBrowser();
        expect(browser.getTitle()).toEqual('Cmis File Picker');
        browser.sleep(5000);

        //create folder
        var pageObject = PageObject.createNew();
        pageObject.addBtn.click();
        pageObject.createFolderBtn.click();
        pageObject.folderNameInput.sendKeys('folderName' + Math.random());
        gnoreSyncronization = true
        browser.sleep(1000);
        pageObject.crateFolderOkBtn.click();
        browser.sleep(1000);
    });

});

